﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace DBKit5
{
    public partial class frmDbRestore : Form
    {
        public frmDbRestore()
        {
            InitializeComponent();
        }

        private void frmDbRestore_Load(object sender, EventArgs e)
        {
            ucConnectionBar1.uc_init();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnParse_Click(object sender, EventArgs e)
        {
            if (tbPath.Text.Length == 0) return;
            if (File.Exists(tbPath.Text))
            {
                MessageBox.Show("文件不存在!");
                return;
            }
            if (!tbPath.Text.EndsWith(".xml"))
            {
                tbSql.Text = File.ReadAllText(tbPath.Text);
                return;
            }

        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {

        }

        private void btnPickFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog() { Filter="SQL 文件|*.sql|XML 文件|*.xml|所有文件|*.*" };
            if (DialogResult.OK != ofd.ShowDialog()) return;
            tbPath.Text = ofd.FileName;
        }
    }
}
